package com.book.controller;


import com.book.pojo.Order;
import com.book.service.OrderService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/")
@RequiredArgsConstructor
public class OrderController {


    private final OrderService orderService;


    @GetMapping("create")
    public Order createOrder(@RequestParam String productId) {
        return orderService.createOrder(productId);
    }

    @GetMapping("pay")
    public Order payOrder(@RequestParam String orderId) {
        return orderService.pay(orderId);
    }

    @GetMapping("send")
    public Order sendOrder(@RequestParam String orderId) {
        return orderService.send(orderId);
    }

    @GetMapping("receive")
    public Order receiveOrder(@RequestParam String orderId) {
        return orderService.receive(orderId);
    }


}
